package com.qms.qep.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.qms.qep.mapper.QepSignatoryMapper;
import com.qms.qep.domain.QepSignatory;
import com.qms.qep.service.IQepSignatoryService;
import com.qms.common.utils.DateUtils;

/**
 * 签名人管理Service业务层处理
 * 
 * @author qms
 * @date 2023-05-20
 */
@Service
public class QepSignatoryServiceImpl implements IQepSignatoryService 
{
    @Autowired
    private QepSignatoryMapper qepSignatoryMapper;

    /**
     * 查询签名人
     * 
     * @param id 签名人ID
     * @return 签名人
     */
    @Override
    public QepSignatory selectQepSignatoryById(Long id)
    {
        return qepSignatoryMapper.selectQepSignatoryById(id);
    }

    /**
     * 查询签名人列表
     * 
     * @param qepSignatory 签名人
     * @return 签名人
     */
    @Override
    public List<QepSignatory> selectQepSignatoryList(QepSignatory qepSignatory)
    {
        return qepSignatoryMapper.selectQepSignatoryList(qepSignatory);
    }

    /**
     * 新增签名人
     * 
     * @param qepSignatory 签名人
     * @return 结果
     */
    @Override
    public int insertQepSignatory(QepSignatory qepSignatory)
    {
        qepSignatory.setCreateTime(DateUtils.getNowDate());
        return qepSignatoryMapper.insertQepSignatory(qepSignatory);
    }

    /**
     * 修改签名人
     * 
     * @param qepSignatory 签名人
     * @return 结果
     */
    @Override
    public int updateQepSignatory(QepSignatory qepSignatory)
    {
        qepSignatory.setUpdateTime(DateUtils.getNowDate());
        return qepSignatoryMapper.updateQepSignatory(qepSignatory);
    }

    /**
     * 批量删除签名人
     * 
     * @param ids 需要删除的签名人ID
     * @return 结果
     */
    @Override
    public int deleteQepSignatoryByIds(Long[] ids)
    {
        return qepSignatoryMapper.deleteQepSignatoryByIds(ids);
    }

    /**
     * 删除签名人信息
     * 
     * @param id 签名人ID
     * @return 结果
     */
    @Override
    public int deleteQepSignatoryById(Long id)
    {
        return qepSignatoryMapper.deleteQepSignatoryById(id);
    }
    
    /**
     * 保存电子签名信息
     * 
     * @param qepSignatory 签名人信息
     * @return 结果
     */
    @Override
    public int saveDigitalSignature(QepSignatory qepSignatory)
    {
        qepSignatory.setUpdateTime(DateUtils.getNowDate());
        return qepSignatoryMapper.updateQepSignatory(qepSignatory);
    }
} 